package com.zx.cashiersystem.mvp.model;

import android.app.ProgressDialog;
import android.content.Context;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.loopj.android.http.RequestParams;
import com.zx.cashiersystem.entitys.OrderInfo;
import com.zx.cashiersystem.utils.Contants;
import com.zx.cashiersystem.utils.HttpUtils;
import com.zx.cashiersystem.utils.SPUtils;

import java.util.List;

/**
 * Created by Administrator on 2017/2/10.
 */

public class OrderLeftModelImpl implements OrderLeftModel {
    @Override
    public void getFromNet(int requestCode, Context context, OnResultListener listener, ProgressDialog progressDialog) {
        RequestParams params = new RequestParams();
        params.put("store_id", SPUtils.getUserinfo(context,SPUtils.STORE_ID));
        HttpUtils.post(context, Contants.GET_ORDER_LIST,params,requestCode,listener,progressDialog);
    }

    @Override
    public List<OrderInfo> asyncJson(String str) {
        return JSON.parseObject(str,new TypeReference<List<OrderInfo>>(){});
    }

}
